package com.example.demo.controller;

import com.example.demo.common.BasePageResponse;
import com.example.demo.common.ResultObject;
import com.example.demo.jooq.tables.pojos.Vps;
import com.example.demo.model.request.VpsPageRequest;
import com.example.demo.model.request.VpsRequest;
import com.example.demo.model.response.EmailResponse;
import com.example.demo.model.response.VpsResponse;
import com.example.demo.service.order.IVpsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("v1/vps/")
public class VpsIpController {
    @Autowired
    private IVpsService iVpsService;
    @GetMapping(value = "list")
    public  ResultObject<BasePageResponse<VpsResponse>> queryPageVpsList(VpsPageRequest vpsPageRequest) {
        return iVpsService.queryPageVpsList(vpsPageRequest);
    }

    /**
     * 保存vps
     * @param vps 数据对象
     * @return
     */
    @PostMapping(value = "save")
    public ResultObject  saveVps(@RequestBody VpsRequest vps) {
        return iVpsService.saveVps(vps);
    }

    /**
     * 查询VPS详情
     * @param vpsId 主键id
     * @return
     */
    @GetMapping(value = "detail")
    public ResultObject<VpsResponse>  queryVpsDetail(@RequestParam("vpsId") String vpsId) {
        return iVpsService.queryVpsDetail(vpsId);
    }


}
